package com.fly.common.common;

/**
 * @description 系统处理码
 * @author: fly
 * @date: 2018/11/21 16:13
 */
public class ErrorConstant {
    public static final int SUCCESS = 200;
    public static final String SUCCESS_MSG = "SUCCESS";

    public static final int METHOD_EXCEPTION = 500;
    public static final String METHOD_EXCEPTION_MSG = "系统错误，请稍后重试";


    public static final int ARGUMENT_NOT_VALID = 400;
    public static final String ARGUMENT_NOT_VALID_MSG = "请求参数不合法";

    public static final int PLEASE_INSTALL_NEW_VERSION = 100;
    public static final String PLEASE_INSTALL_NEW_VERSION_MSG = "请下载新版本";

    public static final int BAD_CREDENTIALS = 1001;
    public static final String BAD_CREDENTIALS_MSG = "无效的认证";

    public static final int EMPTY_CLIENT = 1002;
    public static final String EMPTY_CLIENT_MSG = "client_id不能为空";

    public static final int INVALID_REQUEST = 1003;
    public static final String INVALID_REQUEST_MSG = "请求地址不正确";

    public static final int INVALID_CLIENT = 1004;
    public static final String INVALID_CLIENT_MSG = "client_id或client_secret不正确";

    public static final int INVALID_GRANT = 1005;
    public static final String INVALID_GRANT_MSG = "无效的授权";

    public static final int INVALID_GRANT_BAD = 1006;
    public static final String INVALID_GRANT_BAD_EN_MSG = "Bad credentials";
    public static final String INVALID_GRANT_BAD_CN_MSG = "用户名或者密码不正确";

    public static final int INVALID_GRANT_LOCKED = 1007;
    public static final String INVALID_GRANT_LOCKED_EN_MSG = "User account is locked";
    public static final String INVALID_GRANT_LOCKED_CN_MSG = "用户账户被锁定";

    public static final int UNAUTHORIZED_CLIENT = 1008;
    public static final String UNAUTHORIZED_CLIENT_MSG = "访问未经授权";

    public static final int UNSUPPORTED_GRANT_TYPE = 1009;
    public static final String UNSUPPORTED_GRANT_TYPE_MSG = "不支持的 grant_type";

    public static final int INVALID_SCOPE = 1010;
    public static final String INVALID_SCOPE_MSG = "scope 不正确";

    public static final int INVALID_TOKEN = 1011;
    public static final String INVALID_TOKEN_MSG = "access_token 不正确";

    public static final int UNSUPPORTED_RESPONSE_TYPE = 1012;
    public static final String UNSUPPORTED_RESPONSE_TYPE_MSG = "不支持的 response_type";

    public static final int ACCESS_DENIED = 1013;
    public static final String ACCESS_DENIED_MSG = "访问被拒绝";

    public static final int UNAUTHORIZED = 1014;
    public static final String UNAUTHORIZED_MSG = "访问未经授权";

    public static final int METHOD_NOT_ALLOWED = 1015;
    public static final String METHOD_NOT_ALLOWED_MSG = "不允许该操作";

    public static final int UNAUTHORIZED_USER = 1016;
    public static final String UNAUTHORIZED_USER_MSG = "用户未经授权";

    public static final int CREDENTIALS_EXPIRED = 1017;
    public static final String CREDENTIALS_EXPIRED_MSG = "认证已经过期";

    public static final int EMPTY_SIGN = 1018;
    public static final String EMPTY_SIGN_MSG = "签名参数为空";

    public static final int INVALID_SIGN = 1019;
    public static final String INVALID_SIGN_MSG = "签名参数不合法";

    public static final int USERNAME_PASSWORD_ERROR = 1020;

    public static String getUserNamePasswordErrorMsg(long times) {
        return String.format("用户名或密码不正确，还有%d次机会。", times);
    }

    public static final int USER_LOCKED = 1021;
    public static final String USER_LOCKED_MSG = "密码错误次数超过限制，请您一小时后再试。";

    public static final int EMPTY_ARGUMENT = 10000;
    public static final String EMPTY_ARGUMENT_MSG = "参数不能为空";

    public static final int USER_NULL_ERROR = 300000000;
    public static final String USER_NULL_ERROR_MSG = "用户信息不存在";

    public static final int USER_NAME_OR_PASSWORD_ERROR = 300000001;
    public static final String USER_NAME_OR_PASSWORD_ERROR_MSG = "账户或密码错误";

    public static final int USER_IS_HAD_ERROR = 300000002;
    public static final String USER_IS_HAD_ERROR_MSG = "该账户已被注册";

    public static final int USER_REGISTER_ERROR = 300000003;
    public static final String USER_REGISTER_ERROR_MSG = "用户注册失败";
}
